package org.example.trainTicketSystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.*;
import org.example.trainTicketSystem.DTO.RefundRecordDTO;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@NoArgsConstructor
@Data
@TableName("refund_record")
public class RefundRecord {

    @TableId(type = IdType.AUTO)
    private Integer refundId;

    @TableField
    private Integer saleId;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField
    private LocalDateTime refundTime;

    @TableField
    private String refundReason;

    public RefundRecord(RefundRecordDTO refundRecordDTO) {
        this.saleId = refundRecordDTO.getSaleId();
        this.refundTime = refundRecordDTO.getRefundTime();
        this.refundReason = refundRecordDTO.getRefundReason();
    }
}
